package com.uzhie.jt808.jt1078.entity.param8103;

import com.uzhie.jt808.JT808MsgBody;
import com.uzhie.jt808.msg.entity.MyBuffer;

/**
 * Created by zhangdequan on 2018/8/13.
 */
public class JT_8103_param_video_setting implements JT808MsgBody {

    //实时流编码格式
    private byte mold;
    //实时流分辨率
    private byte ratio;
    //实时流关键帧间隔(1~1000)
    private short frame_rate_interval;
    //实时流目标帧率
    private byte frame_rate;
    //实时流目标码率
    private int bit_rate;


    public byte getMold() {
        return mold;
    }

    public void setMold(byte mold) {
        this.mold = mold;
    }

    public byte getRatio() {
        return ratio;
    }

    public void setRatio(byte ratio) {
        this.ratio = ratio;
    }

    public short getFrame_rate_interval() {
        return frame_rate_interval;
    }

    public void setFrame_rate_interval(short frame_rate_interval) {
        this.frame_rate_interval = frame_rate_interval;
    }

    public byte getFrame_rate() {
        return frame_rate;
    }

    public void setFrame_rate(byte frame_rate) {
        this.frame_rate = frame_rate;
    }

    public int getBit_rate() {
        return bit_rate;
    }

    public void setBit_rate(int bit_rate) {
        this.bit_rate = bit_rate;
    }




    @Override
    public void ReadFromBytes(byte[] body) {
        MyBuffer buffer = new MyBuffer(body);
        //实时流编码格式
        setMold(buffer.get());
        //实时流分辨率
        setRatio(buffer.get());
        //实时流关键帧间隔(1~1000)
        setFrame_rate_interval(buffer.getShort());
        //实时流目标帧率
        setFrame_rate(buffer.get());
        //实时流目标码率
        setBit_rate(buffer.getInt());


    }


    @Override
    public byte[] WriteToBytes() {
        MyBuffer buffer = new MyBuffer();
        buffer.put(getMold());
        buffer.put(getRatio());
        buffer.put(getFrame_rate_interval());
        buffer.put(getFrame_rate());
        buffer.put(getBit_rate());
        return buffer.array();
    }

}
